for idx = 1:32
    preprocessed_sub_4600 = zeros(4600, 10, 32, 32);
    sub_4600 = readNPY(strcat("C:\Users\john\Desktop\learn-eeg\plv_matrix\s", num2str(idx, '%02d'), "\", num2str(idx), ".npy"));
    disp(strcat('---------------', num2str(idx), '-------------------'));
    for sub_idx=1:4600
        for ch_idx=1:10
            plv_mat = squeeze(sub_4600(sub_idx, ch_idx, :, :));
            sorted_matrix = sort_connectivity_matrix(plv_mat, 'global');
            preprocessed_sub_4600(sub_idx, ch_idx, :, :) = reshape(sorted_matrix, [1, 1, 32, 32]);
            disp(strcat('---------------idx:', num2str(idx), '---sub-idx', num2str(sub_idx), '---chidx', num2str(ch_idx), '-------------------'));
        end
    end


    folder_path = fullfile('C:', 'Users', 'john', 'Desktop', 'learn-eeg', 'plv_matrix_global', sprintf('s%02d', idx));
    if ~exist(folder_path, 'dir')
        mkdir(folder_path);
    end
    
    filename = fullfile(folder_path, [num2str(idx), '.mat']);
    save(filename, 'preprocessed_sub_4600');  % 注意变量名加单引号！
    disp(strcat('---------------', num2str(idx), '-------------------'));
end